/***********************************************
/gen auto by zuitools
***********************************************/
#ifndef __MAINACTIVITY_H__
#define __MAINACTIVITY_H__


#include "app/Activity.h"
#include "entry/EasyUIContext.h"

#include "uart/ProtocolData.h"
#include "uart/ProtocolParser.h"

#include "utils/Log.h"
#include "control/ZKDigitalClock.h"
#include "control/ZKButton.h"
#include "control/ZKCircleBar.h"
#include "control/ZKDiagram.h"
#include "control/ZKListView.h"
#include "control/ZKPointer.h"
#include "control/ZKQRCode.h"
#include "control/ZKTextView.h"
#include "control/ZKSeekBar.h"
#include "control/ZKEditText.h"
#include "control/ZKVideoView.h"
#include "window/ZKSlideWindow.h"

/*TAG:Macro宏ID*/
#define ID_MAIN_TextView68    50092
#define ID_MAIN_timeTip    50091
#define ID_MAIN_CurTime    50086
#define ID_MAIN_TextView73    50090
#define ID_MAIN_timeWnd    110016
#define ID_MAIN_TextView63    50081
#define ID_MAIN_TextView60    50080
#define ID_MAIN_TextView56    50078
#define ID_MAIN_TextView53    50022
#define ID_MAIN_TempText_    50077
#define ID_MAIN_TextView52    50076
#define ID_MAIN_TextView51    50074
#define ID_MAIN_TextView32    50056
#define ID_MAIN_TextView31    50055
#define ID_MAIN_TextView30    50048
#define ID_MAIN_TextView29    50041
#define ID_MAIN_TextView23    50040
#define ID_MAIN_TextView16    50039
#define ID_MAIN_TextView15    50034
#define ID_MAIN_YieldText    50017
#define ID_MAIN_TempText    50016
#define ID_MAIN_IceTimeBar    91003
#define ID_MAIN_TextView6    50032
#define ID_MAIN_Button2    20009
#define ID_MAIN_TextView1    50029
#define ID_MAIN_IceTipWnd    110015
#define ID_MAIN_refrigerTipWnd    110008
#define ID_MAIN_TextView79    50089
#define ID_MAIN_Button1    20005
#define ID_MAIN_TextView36    50019
#define ID_MAIN_refrigerTip1    50020
#define ID_MAIN_YieldTip    50079
#define ID_MAIN_TextView78    50067
#define ID_MAIN_WinConstant    110014
#define ID_MAIN_TextView77    50023
#define ID_MAIN_TextView62    50061
#define ID_MAIN_TextView45    50060
#define ID_MAIN_coverWndR2    110011
#define ID_MAIN_TextTempR    50066
#define ID_MAIN_TextYieldR    50062
#define ID_MAIN_coverWndR    110012
#define ID_MAIN_TextView44    50058
#define ID_MAIN_TextView42    50026
#define ID_MAIN_TextView41    50025
#define ID_MAIN_TextView37    50024
#define ID_MAIN_coverWnd2    110010
#define ID_MAIN_HideIce    20008
#define ID_MAIN_IceOn    20007
#define ID_MAIN_TextView35    50021
#define ID_MAIN_IceMakingWnd    110009
#define ID_MAIN_HideCold    20006
#define ID_MAIN_refrigerationOn    20004
#define ID_MAIN_refrigerationWnd    110013
#define ID_MAIN_SubItem_name    24008
#define ID_MAIN_ListView_load_state    80006
#define ID_MAIN_TextView65    50083
#define ID_MAIN_TextView64    50082
#define ID_MAIN_TextView70    50088
#define ID_MAIN_TextView69    50087
#define ID_MAIN_TextView67    50085
#define ID_MAIN_TextView66    50084
#define ID_MAIN_TextView61    50075
#define ID_MAIN_TextView54    50069
#define ID_MAIN_TextView59    50073
#define ID_MAIN_TextView50    50068
#define ID_MAIN_TextView43    50030
#define ID_MAIN_TextView49    50065
#define ID_MAIN_TextView48    50064
#define ID_MAIN_TextView47    50057
#define ID_MAIN_TextView40    50028
#define ID_MAIN_TextView39    50027
#define ID_MAIN_TextView38    50015
#define ID_MAIN_TextView46    50063
#define ID_MAIN_TextView33    50054
#define ID_MAIN_TextView71    50105
#define ID_MAIN_TextView21    50046
#define ID_MAIN_TextView14    50038
#define ID_MAIN_TextView24    50049
#define ID_MAIN_TextView19    50044
#define ID_MAIN_TextView13    50036
#define ID_MAIN_TextView7    50031
#define ID_MAIN_TextView28    50053
#define ID_MAIN_TextView8    50033
#define ID_MAIN_TextView18    50043
#define ID_MAIN_TextView26    50051
#define ID_MAIN_TextView12    50037
#define ID_MAIN_TextView10    50035
#define ID_MAIN_TextView20    50045
#define ID_MAIN_TextView34    50059
#define ID_MAIN_TextView72    50106
#define ID_MAIN_TextView27    50052
#define ID_MAIN_TextView22    50047
#define ID_MAIN_TextView76    50111
#define ID_MAIN_TextView74    50108
#define ID_MAIN_TextView25    50050
#define ID_MAIN_TextView17    50042
#define ID_MAIN_TextView75    50110
#define ID_MAIN_TextView55    50070
#define ID_MAIN_TextView58    50072
#define ID_MAIN_TextView57    50071
#define ID_MAIN_WindowLog    110007
#define ID_MAIN_TextTempL    50010
#define ID_MAIN_TextYieldL    50009
#define ID_MAIN_TextView4    50008
#define ID_MAIN_Yieldtype    50007
#define ID_MAIN_coverWnd    110006
#define ID_MAIN_SeekBarYield    91002
#define ID_MAIN_SeekBarTemp    91001
#define ID_MAIN_TextView11    50014
#define ID_MAIN_CurYield    50013
#define ID_MAIN_YieldWnd    110005
#define ID_MAIN_TextView9    50012
#define ID_MAIN_CurTemp    50011
#define ID_MAIN_TempWnd    110004
#define ID_MAIN_TextView5    50005
#define ID_MAIN_TextCollect    50006
#define ID_MAIN_TextWater    50004
#define ID_MAIN_TextView3    50003
#define ID_MAIN_outIce    20003
#define ID_MAIN_WinIce    110003
#define ID_MAIN_TextView2    50002
#define ID_MAIN_outWater    20001
#define ID_MAIN_collect    20002
#define ID_MAIN_TextTip    50001
#define ID_MAIN_TextViewtpde    50107
#define ID_MAIN_TextViewTemp    50101
#define ID_MAIN_WinInfo    110002
#define ID_MAIN_WaterCmd    50018
#define ID_MAIN_WaterWnd    110001
#define ID_MAIN_SubItem2    24002
#define ID_MAIN_SubItem1    24001
#define ID_MAIN_MainList    80001
/*TAG:Macro宏ID END*/

class mainActivity : public Activity, 
                     public ZKSeekBar::ISeekBarChangeListener, 
                     public ZKListView::IItemClickListener,
                     public ZKListView::AbsListAdapter,
                     public ZKSlideWindow::ISlideItemClickListener,
                     public EasyUIContext::ITouchListener,
                     public ZKEditText::ITextChangeListener,
                     public ZKVideoView::IVideoPlayerMessageListener
{
public:
    mainActivity();
    virtual ~mainActivity();

    /**
     * 注册定时器
     */
	void registerUserTimer(int id, int time);
	/**
	 * 取消定时器
	 */
	void unregisterUserTimer(int id);
	/**
	 * 重置定时器
	 */
	void resetUserTimer(int id, int time);

protected:
    /*TAG:PROTECTED_FUNCTION*/
    virtual const char* getAppName() const;
    virtual void onCreate();
    virtual void onClick(ZKBase *pBase);
    virtual void onResume();
    virtual void onPause();
    virtual void onIntent(const Intent *intentPtr);
    virtual bool onTimer(int id);

    virtual void onProgressChanged(ZKSeekBar *pSeekBar, int progress);

    virtual int getListItemCount(const ZKListView *pListView) const;
    virtual void obtainListItemData(ZKListView *pListView, ZKListView::ZKListItem *pListItem, int index);
    virtual void onItemClick(ZKListView *pListView, int index, int subItemIndex);

    virtual void onSlideItemClick(ZKSlideWindow *pSlideWindow, int index);

    virtual bool onTouchEvent(const MotionEvent &ev);

    virtual void onTextChanged(ZKTextView *pTextView, const string &text);

    void rigesterActivityTimer();

    virtual void onVideoPlayerMessage(ZKVideoView *pVideoView, int msg);
    void videoLoopPlayback(ZKVideoView *pVideoView, int msg, size_t callbackTabIndex);
    void startVideoLoopPlayback();
    void stopVideoLoopPlayback();
    bool parseVideoFileList(const char *pFileListPath, std::vector<string>& mediaFileList);
    int removeCharFromString(string& nString, char c);


private:
    /*TAG:PRIVATE_VARIABLE*/
    int mVideoLoopIndex;
    int mVideoLoopErrorCount;

};

#endif